<%@page import="com.kaishengit.dao.ProdDao"%>
<%@page import="com.kaishengit.entity.Prod"%>
<%@page import="com.kaishengit.entity.OrderItem"%>
<%@page import="com.kaishengit.entity.Order"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="top.jsp" %>
<html>
  <head>
    
    <title>My JSP 'showorder.jsp' starting page</title>
  </head>
  
  <body>
	<%
		Order order = (Order)request.getAttribute("order");
		List<OrderItem> list = (List<OrderItem>)request.getAttribute("itemlist");
	 %>
	
		<div class="container" style="padding-top:60px">
			<div class="span8">
				<h3>订单信息</h3>
				<dl class="dl-horizontal">
					
					<dt>收货信息</dt>
						<dd><%=order.getName() %>,<%=order.getTel() %>,<%=order.getAddress() %></dd>
					<dt>订单状态</dt>
						<dd><%=order.getState() %></dd>
					<dt>订单编号</dt>
						<dd><%=order.getId() %></dd>
					<dt>下单时间</dt>
						<dd><%=order.getCreatetime() %></dd>
				</dl>
			</div>
		</div>
		 
	 <hr/>
	 <div class="span10 offset1">
	 	<table class="table table-striped table-bordered">
			<thead>
				<tr>
					<th>宝贝</th>
					<th>单价</th>
					<th>数量</th>
					<th>总价</th>
				</tr>
			</thead>
			<%
				float total = 0f;
				for(OrderItem item : list) {
					total += item.getTotal();
			 %>
			<tbody>
				<tr>
				<td><%
					int id = item.getProdid(); 
					Prod prod = new ProdDao().findById(id);
					%>
					<%=prod.getProdname() %>
				</td>
				<td>
					<%=prod.getPrice() %>
				</td>
				<td><%=item.getNum() %></td>
				<td><%=item.getTotal() %></td>
				</tr>
			</tbody>
			<%} %>
		</table>
	 </div>
	<div class="container">
		<div class="pull-right">
		实付款:<h2 style="color:red">￥<%=total %>元</h2>
	 </div>	
	</div>
	 
	
  </body>
</html>
